package com.jdjw.modules.officialseal.service.impl;

import com.jdjw.common.ResponseResult;
import com.jdjw.modules.officialseal.entity.OfficialSeal;
import com.jdjw.modules.officialseal.entity.OfficialSealVo;
import com.jdjw.modules.officialseal.mapper.OfficialSealMapper;
import com.jdjw.modules.officialseal.service.OfficialSealService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 公章使用审核 服务实现类
 * </p>
 *
 * @author fq
 * @since 2021-07-19
 */
@Service
public class OfficialSealServiceImpl extends ServiceImpl<OfficialSealMapper, OfficialSeal> implements OfficialSealService {

    @Autowired
    private OfficialSealMapper officialSealMapper;



    @Override
    public ResponseResult queryAll(OfficialSealVo officialSealVo) {
        List<OfficialSeal> officialSeals = officialSealMapper.queryAll(officialSealVo);
        ResponseResult rrt=new ResponseResult();
        if(officialSeals!=null){
            rrt.setMsg("查询成功");
            rrt.setCode(200);
            rrt.setData(officialSeals);
        }else{
            rrt.setMsg("查询失败");
            rrt.setCode(500);
            rrt.setData(null);
        }
        return rrt;
    }

    @Override
    public ResponseResult editSql(String sqlEdit) {
        ResponseResult rrt=new ResponseResult();
        Boolean aBoolean = officialSealMapper.editSql(sqlEdit);
        if(aBoolean){
            rrt.setMsg("编辑成功");
            rrt.setCode(200);
        }else{
            rrt.setMsg("编辑失败");
            rrt.setCode(500);
        }
        return rrt;
    }
}
